#ifndef DATABASEMANAGER_H
#define DATABASEMANAGER_H
#include <cstring>
#include <sqlite3.h>
#include <iostream>
#include <mutex>
using namespace std;
    
class DatabaseManager
{
public:
  static DatabaseManager& getInstance()
    {
         static DatabaseManager instance;
         return instance;
    }

    sqlite3_stmt *prepare(const string &sql);  //解析数据库中的内容将转换为二进制可以直接被机器运行
    DatabaseManager(const DatabaseManager&) = delete;
    void operator=(const DatabaseManager&) = delete;
    
    sqlite3* getDB(){return db;}  //获取数据库的接口
    
     
private:
    DatabaseManager();
    ~DatabaseManager();
    sqlite3 *db;
    mutex db_mutex;  // 添加数据库互斥锁
};




#endif